/*
 * 
 */
package fr.univtln.superplanning.persistence;

import java.util.HashMap;
import java.util.Map;

/**
 * This class provides static method to manager database.
 * 
 * @author vincent
 * 
 */
public class DatabaseManager {

	// // Some statics declarations /////
	/** this static map associate a driver name to the driver location. */
	public static final Map<String, String> DATABASE_DRIVERS = new HashMap<String, String>();

	// TODO: chercher les drivers pour mysql & oracle ;)
	static {
		DATABASE_DRIVERS.put("postgresql", "org.postgresql.Driver");
		DATABASE_DRIVERS.put("mysql", "a_chercher");
		DATABASE_DRIVERS.put("oracle:thin", "a_chercher");
	}

	private static DBLogin dbLogin = new DBLogin();

	public static DBLogin getDbLogin() {
		return dbLogin;
	}
	
	public static boolean isConnected() {
		return dbLogin.getEntityManager().isOpen();
	}

	public static void setDbLogin(DBLogin dbLogin) {
		DatabaseManager.dbLogin = dbLogin;
	}

}
